package HGbet;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;







import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;




import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.ParseException;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.CookieStore;
import org.apache.http.client.config.CookieSpecs;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.cookie.Cookie;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.python.antlr.PythonParser.return_stmt_return;

import DXQclient.DXQclientManager;
import P8.SoundThread;
import P8.StoneAgeClient;

public class HGbethttp {
		static CloseableHttpClient httpclient = null;
		RequestConfig requestConfig = null;
		HttpClientContext clientContext = null;
		//DXQclientManager dxqClientManager = null;
		
		CookieStore cookieStore =  new BasicCookieStore();
		
		public HGbethttp(){
			//dxqClientManager = manager;
		    requestConfig = RequestConfig.custom().setCookieSpec(CookieSpecs.STANDARD).build();
		    requestConfig = RequestConfig.copy(requestConfig).setRedirectsEnabled(false).build();//禁止重定向 ， 以便获取cookieb18
		    //requestConfig = RequestConfig.copy(requestConfig).setConnectTimeout(autoBet.timeOut).setConnectionRequestTimeout(autoBet.timeOut).setSocketTimeout(autoBet.timeOut).build();//设置超时
		    httpclient = HttpClients.custom().setDefaultRequestConfig(requestConfig).setDefaultCookieStore(cookieStore).build();
		 }
		 
		  static int defaultTimeout = 60000;
		 
		 
		  static long lastBettime = 0L;
		  long lastConfirmtime = 0L;
		 
		  static String FirstADDRESS = "";
		  static String ADDRESS = "";
		  static String ACCOUNT = "";
		  static String PWD = "";
		  String SECURITYCODE = "";
		 
		  static String user_id = "";
		  String mtype = "3";
		 String cid = "";
		 int time_zone = 0;
		 
		 
		// String confirmtoomanytimes
		 
		 
		  static String[] blackboxarry = {"0400AKHeWb1CT4UHcCiyOFFxUNoAbcdXcQUgwTpqC7aOF/G7cVE#xxeTH9qn7gvBN1hODpQyKLUtdcy/gVjxK6YQUmuthzD1rRD5A9buc5roGxhe#J5xbAcO8rvcbfkqJhb4bZWp/5NFsh3QANolZLufCAU8wqwM/zbpaoaJowy5lsfph/T#lMlRTFuxuMBV69L9DJ0qCc4gMpergecSo06izT8HnO#s8lyWpM5YbymrVY7rLMnUY2Yy4xZkFqaUZegb#KaePAdj0dC1DOkZ9ybRxHxfYV3WeA0UYsMZmVY5fSPUN2oHNYZpt1ozpn47xUgPTMj6Y82LrlflYU9iUMb03YzV7IDBIIRtgx5t4CWwXewJB/s4Mwp5btF9#kXk6jWRmbs9iiKKERy6gt7Yfou88A1/InDlj2XMuF6OiUfqPLjYdgXmjJkcl5haIlLY6FnWC1qHoGk5NgOHQJG3PEGJQEF/V33vgKI2yAfUMZ5LKFpDFK356A5kn36mAJ3ZTHu23WaFMcpDuPLLCLfgMB41yXjhWeZaUwkKrI3MaSYrgzuOZTYvnKL0JQQ08ROukpTpxifyrThRovESnjwNVGXSgGQ8InPsuf6/kpMgG84gzO5PMQF00uJew9XqxzJ4y#q4mStCxJc9SdMLWoegaTk2A7mDLXBle34GVIAW7uDQjXPJ5KZOY#8O2Z5lbKwbkY1WLiLEJ4zNTnk1gG7#dJK6MAX8iYyy5jvSmz61zhzFB1cNGV#VxgYnSsjwjs5Ca2/wBdhim9vK/Uu9reMfedtEcWxVYQhoLMwdw7yV1babUQ9E2YEMBkBTaDK2Ap43KhSPYo1spIJ6RkczIxiUCD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o0vYYDC32yzkoyzQ#ygbazR87feXj71svFCT6Ov7Yw#v18d#0yS15tFwbb5NkVtrNHzt95ePiOZHcvZ6IAScycRhS8EwApMRV0YmXEHAJzxpxtwqoC5Z/uCi7ME8loQwLLSzeFEuVfe4edP#YyrpLGfoBXHPGmAK81UAHE2E2u0pn#Innr/ljAlWwXHcT/nzMar#FnRmjKx4PQbX9OHEQi#wlGoZ8X2ykV3stOnGOGu3rhaojFIr5XHrcXp6A3e7luHyq04xmEqhJPR2E4I4JJTShk9Y0R8X2Fd1ngNFGSttdZygKPcQVL2duy/r6Bk2cfD0IHAIf2vFnup4QVZtxuYX9q9IiEsTRsX2iDt47aA7i9b/u2t0A10ypglwUmHx1LoMgctHwW38FulBRcvThKBGpvCWRuaPV05/rNW7Sw#Jld00Kp8oBvPA6u04i1McDaVptovbdciPTQaFQzmis8lWzfSwoZmlBHKop6a4uHlWBi8fPnYDmhH8iNT5tmMPY7fFSAH5m0B4eJx8sYQo5pLMLpVT1gUUA3pDXHzRas4/GRSXiLQ54QCNybshp8xmd6#cm1leBbxOLrw4TB1HlsVxjSt997YXo3BTCX2hgUbAxLxsAZ7wObrIPkDUNP0j4sb9K9aP#bHa83CDZB6X9z3t5GOE3v/P0fK0Mpi/qz28j7#e7ulr6Q2kPzVR88eWj0RX0JHstg9WGLJ44uwgvmQv7oSpR7vSRRYaqhKKhmTNPWCy4nJzQCugKVOTcKUJixNc9QoXJB6xfRWCqp0tokzUp0K#OKLn0OAhXJ9AFUmoq3MFE1OVZYIN0TiGh2ocxF8rf4jemlekKDk9nbjLKqMlA4FJr4dyXapdkDIJTQkZrrm8#sZ"
		 };	
		 
		 
		  static String chars = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890";
		 
	     static Vector<Long> lastTenRequestTime = new Vector<Long>();
	     static long avgRequestTime = 0;    
	     static boolean bcalcRequestTime = true;
	    boolean bneedChangeLine = false;
	   
	   
	     static long lastChangeLineTime = 0;
	   
	     static String strCookies = "";
		 
	 
		public static  void setLoginParams(String address, String account, String pwd){
			FirstADDRESS = address;
			ADDRESS = address;
			ACCOUNT = account;
			PWD = pwd;
		}
		
		public  void setAccount(String account){
			ACCOUNT = account;
		}
		
		public void setAddress(String address) {
			ADDRESS = address;
		}
		
		public void setPassword(String password) {
			PWD = password;
		}
		
		public  String getaccount(){
			return ACCOUNT;
		}
		
		public String getAddress() {
			return ADDRESS;
		}
		
		public String getPassword() {
			return PWD;
		}
	    
		
		
		
		public List<Cookie> getCookiesStrore(){
			return cookieStore.getCookies();
		}
		
		
		
		
	    public  int login(){// 1成功	2维护   -1失败
	    	
	    	try{
	    		
	    		ADDRESS = FirstADDRESS;
	    		
	        	String loginLine = ADDRESS;
	        	
	        	String res = doGet(loginLine, "", "");
	        	
	        	
	        	
	        	
	        	
	        	String iovationKey = "IDIEHA";
	        	
	        	
	        	int outps = res.indexOf("top.iovationKey");
	        	
	        	outps = res.indexOf("\'", outps) + 1;
	        	
	        	int outpe = res.indexOf("\'", outps);
	        	
	        	iovationKey = res.substring(outps, outpe);
	        	
	        	System.out.println("address" + ADDRESS + "        account:" + ACCOUNT + "    pwd:" + PWD);
	        	
	        	
	        	//String restmp = doGet("http://sbc.ry00000.com/iovation/vindex.html?webProtocal=http&webDomain=66.133.87.49", "", "");
	        	
	        	
	        	if(res.contains("è")){
            		res = new  String(res.getBytes("ISO-8859-1"), "utf-8");
            	}
	        	
	        	if(res != null && res.contains("Welcome")){
	        		res = doGet(loginLine + "app/member/", "", "");
	        		
	        		if(res.contains("è")){
	            		res = new  String(res.getBytes("ISO-8859-1"), "utf-8");
	            	}
	        		
	        		if(res.contains("連對方的資料")){
	        			
	        			
	    		        int arrayindex =0;
	    		        String blackbox = blackboxarry[arrayindex];
	    		        StringBuilder strBuilder = new StringBuilder(blackbox);
	    		        for(int i = 26; i < 34; i++){
	    		        	strBuilder.setCharAt(i, chars.charAt((int)(Math.random()*62)));
	    		        }
	    		        blackbox = strBuilder.toString();
	        			
	        			
	    		        List<NameValuePair> paramstmp = new ArrayList<NameValuePair>();
	    		        paramstmp.add(new BasicNameValuePair("blackbox",blackbox));
	    		        
	    		        
	        			
	        			res = doPost(ADDRESS + "iovation/vindex.php", paramstmp, "");
	        			
	        			if(res.contains("è")){
	                		res = new  String(res.getBytes("ISO-8859-1"), "utf-8");
	                	}
	        			
	    		        List<NameValuePair> params = new ArrayList<NameValuePair>();		  
	    		        
	    		        params.add(new BasicNameValuePair("username", ACCOUNT));
	    		        params.add(new BasicNameValuePair("passwd", PWD));
	    		        params.add(new BasicNameValuePair("auto", iovationKey));
	    		        params.add(new BasicNameValuePair("langx", "zh-cn"));
//	    		        params.add(new BasicNameValuePair("blackbox", "0400AKHeWb1CT4UHcCiyOFFxUJD6OGoUJSQTwTpqC7aOF/G7cVE#xxeTH9qn7gvBN1hODpQyKLUtdcy/gVjxK6YQUmuthzD1rRD5A9buc5roGxhe#J5xbAcO8rvcbfkqJhb4bZWp/5NFsh3QANolZLufCAU8wqwM/zbpaoaJowy5lsfph/T#lMlRTFuxuMBV69L9DJ0qCc4gMpergecSo06izT8HnO#s8lyWpM5YbymrVY7rLMnUY2Yy4xZkFqaUZegb#KaePAdj0dC1DOkZ9ybRxHxfYV3WeA0UYsMZmVY5fSPUN2oHNYZpt1ozpn47xUgPTMj6Y82LrlflYU9iUMb03YzV7IDBIIRtgx5t4CWwXewJB/s4Mwp5btF9#kXk6jWRvd0xEDci3XvJQSlmPeFzMw1/InDlj2XMuF6OiUfqPLjYdgXmjJkcl5haIlLY6FnWC1qHoGk5NgOHQJG3PEGJQEF/V33vgKI2yAfUMZ5LKFpDFK356A5kn36mAJ3ZTHu23WaFMcpDuPLLCLfgMB41yXjhWeZaUwkKrI3MaSYrgzuOZTYvnKL0JQQ08ROukpTpxifyrThRovESnjwNVGXSgGQ8InPsuf6/kpMgG84gzO5PMQF00uJew9XqxzJ4y#q4mStCxJc9SdMLWoegaTk2A7mDLXBle34GVIAW7uDQj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FEuVfe4edP#YyrpLGfoBXHPGmAK81UAHE2E2u0pn#Innr/ljAlWwXHcT/nzMar#FnRmjKx4PQbX9OHEQi#wlGoZ8X2ykV3stOnGOGu3rhaojFIr5XHrcXp6A3e7luHyq04xmEqhJPR2E4I4JJTShk9Y0R8X2Fd1ngNFGSttdZygKPcQVL2duy/r6Bk2cfD0IHAIf2vFnup4QVZtxuYX9q9IiEsTRsX2iDt47aA7i9b/u2t0A10ypglwUmHx1LoMgctHwW38FulBRcvThKBGpvCWRuaPV05/rNW7Sw#Jld00Kp8oBvPA6u04i1McDaVptovbdciPTQaFQzmis8lWzfSwoZmlBHKop6a4uHlWBi8fPnYDmhH8iNT5tmMPY7fFSAH5m0B4eJx8sYQo5pLMLpVT1gUUA3pDXHzRas4/GRSXiLQ54QCNybshp8xmd6#cm1leBbxOLrw4TB1HlsVxjSt997YXo3BTCX2hgUbAxLxsAZ7wObrIPkDUNP0j4sb9K9aP#bHa83CDZB6X9z3t5GOE3v/P0fK0Mpi/qz28j7#e7ulr6Q2kPzVR88eWj0RX0JHstg9WGLJ44uwgvmQv7oSpR7vSRRYaqhKKhmTNPWCy4nJzQCugKVOTcKUJixNc9QoXJB6xfRWCqp0tokzUp0K#OKLn0OAhXJ9AFUmoq3MFE1OVZYIN0TiGh2ocxF8rf4jemlekKDk9nbjLKqMlA4FJr4dyXapdkDIJTQkZrrm8#sZ"));
	    		        
/*	    		        int arrayindex =(int)(Math.random()*4);
	    		        String blackbox = blackboxarry[arrayindex];
	    		        StringBuilder strBuilder = new StringBuilder(blackbox);
	    		        for(int i = 26; i < 34; i++){
	    		        	strBuilder.setCharAt(i, chars.charAt((int)(Math.random()*62)));
	    		        }
	    		        blackbox = strBuilder.toString();*/
	    		        
	    		        
	    		        params.add(new BasicNameValuePair("blackbox",blackbox));
	    		        res = doPost(ADDRESS + "app/member/new_login.php", params, "");
	    		        
	    		        if(res.contains("è")){
	                		res = new  String(res.getBytes("ISO-8859-1"), "utf-8");
	                	}
	    		        
	    		        if(null != res && res.contains("200|100")){
	    		        	
	    		        	int ps = res.indexOf("||") + 2;
	    		        	int pe = res.indexOf("|",ps);
	    		        	
	    		        	user_id = res.substring(ps, pe);
	    		        	
	    		        	
	    		        	//http://66.133.87.49/app/member/FT_index.php?mtype=3&uid=0bqe5ubeqm17590281l2308157&langx=zh-cn&news_mem=Y
	    		        	
	    		        	
	    		        	//为了获取cookie
	    		        	//res = doGet(ADDRESS + "app/member/FT_index.php?mtype=" + mtype + "&uid=" + user_id + "&langx=zh-cn&news_mem=Y" ,"", "" );
	    		        	
	    		        	
	    		        	
	    		        	
	    		        	
	    		        	
	    		        	return 1;

	    		        }
	    		        
	    		        
	        		}
	        		
	        		
	        	}
	        	
	        	System.out.println("登录失败nimb:");
	        	
	        	System.out.println(res);
	        	
	        	if(res.contains("System Maintenance")){
	        		return 2;
	        	}else if(res.contains("today_gmt")){
	        		return 1;
	        	}
	        	
	    		
	    	}catch(Exception e){
	    		e.printStackTrace();
	    		return -1;
	    	}
	    	

	    	
	    	return -1;
	    }    
	    
	    public  boolean checkAccountonline(){
	    	
	    	String res = "";
	    	
	    	try{
	    		
	    		res = doGet(ADDRESS + "app/member/result/result.php?game_type=FT&" + "uid=" + user_id + "&langx=zh-cn", "", "");

	    		
	    		
	    		
	        	if(res == null){
	        		Thread.sleep(1500);
	        		res = doGet(ADDRESS + "app/member/result/result.php?game_type=FT&" + "uid=" + user_id + "&langx=zh-cn", "", "");
	        	}
	        	
	        	
	        	if(res.contains("getElementById('newdomain')")){
	        		
	        		int ps = res.indexOf("action");
	        		ps = res.indexOf("\'", ps) + 1;
	        		int pe = res.indexOf("\'", ps);
	        		
	        		ADDRESS = res.substring(ps, pe) + "/";
	        		
	        		res = doGet(ADDRESS + "app/member/result/result.php?game_type=FT&" + "uid=" + user_id + "&langx=zh-cn", "", "");
	        	}
	        	
	        	
	        	
	        	if(res != null && res.contains("logout_warn")){
	        		return false;
	        	}
	        	
	        	
	        	System.out.println("检查在线情况输出:" + res);
	        	
	    		
	    		if(res != null && res.contains("足球 : 赛果")){
	    			
	    			
	    			
	    			return true;
	    		}
	    		
	    	}catch(Exception e){
	    		
	    		e.printStackTrace();
	    		return false;
	    		
	    	}
	            
	            
	    	System.out.println(res);
	    	
	    	return false;
	    }
	    
	    
	    
	    
	    
	    public  static String[] doBetDXQ(DXQclientManager dxqClientManager, String gid, String gnum, String type, int gold, String betpankou){
	    	
	    	try{
	    		
	    		
	    		SimpleDateFormat dfSec = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	    		
	    		if(System.currentTimeMillis() - lastBettime < 3 * 1000){
	    			System.out.println(dfSec.format(System.currentTimeMillis()) + "投注频繁");
	    			String[] rvalue = {"100", ""};//hold on
	    			return rvalue;
	    		}
	    		
	    		
	    		
	    		
	    		//发出声音
	    		if(SoundThread.inPlay == false){
					SoundThread st = new SoundThread();
					st.start();
				}
	    		
	    		
	    		
	    		
	    		
	    		
	    		
	    		
	    		
	    		
		    	String uri = ADDRESS + "app/member/FT_order/FT_order_rou.php?gid=" + gid + "&uid=" + user_id + "&odd_f_type=M&type=" + type + 
	    				"&gnum=" + gnum +  "&langx=zh-cn";
		    	
		    	String res = doGet(uri, "", "");
		    	
		    	
		    	
		    	if(res.contains("getElementById('newdomain')")){
	        		
	        		int ps = res.indexOf("action");
	        		ps = res.indexOf("\'", ps) + 1;
	        		int pe = res.indexOf("\'", ps);
	        		
	        		ADDRESS = res.substring(ps, pe) + "/";
	        		
	        		uri = ADDRESS + "app/member/FT_order/FT_order_rou.php?gid=" + gid + "&uid=" + user_id + "&odd_f_type=M&type=" + type + 
		    				"&gnum=" + gnum +  "&langx=zh-cn";
	        		
	        		res = doGet(uri, "", "");
	        	}
		    	
		    	
		    	
		    	
		    	
		    	Map<String, String> map=new HashMap<String, String>();
		    	
		    	if(res == null){
		    		res = doGet(uri, "", "");
		    	}
		    	
		    	if(res.contains("logout_warn")){
		    		int logres = StoneAgeClient.hgbet.login();
		    		if(logres == 1){
		    			res = doGet(uri, "", "");
		    		}
		    	}
		    	
		    	
		    	Thread.sleep(1500);
		    	
		    	
		    	if(res.contains("è")){
            		res = new  String(res.getBytes("ISO-8859-1"), "utf-8");
            	}
		    	
		    	
		    	
		    	if(res != null && res.contains("确定交易")){
		    		
		    		
		    		
		    		Thread.sleep(1500);
		    		
		    		
		    		
		    		int ps = res.indexOf("\"team\"");
		    		ps = res.indexOf("em>", ps) + 3;
		    		int pe = res.indexOf("<", ps);
		    		
		    		String pankou = res.substring(ps, pe);
		    		
		    		if(pankou.contains("大")){
		    			pankou = pankou.replace("大", "");
		    		}else if(pankou.contains("小")){
		    			pankou = pankou.replace("小", "");
		    		}
		    		
		    		
		    		pankou = pankou.replace(" ", "");
		    		
		    		if(!pankou.equals(betpankou)){
		    			String[] rvalue = {"-3","投注失败，错失盘口"};
		    			System.out.println(dfSec.format(System.currentTimeMillis()) + "投注失败，错失盘口");
    		        	return rvalue;
		    		}
		    		
		    		
		    		
	    			ps = res.indexOf("name=\"active\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String active = res.substring(ps,pe);
	    			
	    			ps = res.indexOf("name=\"line_type\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String line_type = res.substring(ps,pe);
	    			
	    			ps = res.indexOf("name=\"concede_h\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String concede_h = res.substring(ps,pe);
	    			
	    			
	    			
	    			ps = res.indexOf("name=\"radio_h\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String radio_h = res.substring(ps,pe);
	    			
	    			
	    			ps = res.indexOf("name=\"ioradio_r_h\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String ioradio_r_h = res.substring(ps,pe);
	    			
	    			
	    			
	    			double ratio = Double.parseDouble(ioradio_r_h);
	    			if(ratio < 0.0){
	    				ratio = 2.0- ratio;
	    			}
	    			if(dxqClientManager.getminbetratio() > ratio || dxqClientManager.getmaxbetratio() < ratio){
	    				String[] rvalue = {"-3","投注失败，错失水位"};
	    				System.out.println(dfSec.format(System.currentTimeMillis()) + "投注失败，错失水位");
    		        	return rvalue;
	    			}
	    			
	    			
	    			
	    			
	    			
	    			ps = res.indexOf("name=\"gmax_single\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String gmax_single = res.substring(ps,pe);	   
	    			
	    			
	    			ps = res.indexOf("name=\"gmin_single\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String gmin_single = res.substring(ps,pe);	  
	    			
	    			
	    			ps = res.indexOf("name=\"singlecredit\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String singlecredit = res.substring(ps,pe);	  
	    			
	    			
	    			
	    			ps = res.indexOf("name=\"singleorder\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String singleorder = res.substring(ps,pe);	  
	    			
	    			
	    			
	    			ps = res.indexOf("name=\"restsinglecredit\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String restsinglecredit = res.substring(ps,pe);	  
	    			
	    			ps = res.indexOf("name=\"wagerstotal\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String wagerstotal = res.substring(ps,pe);	  
	    			
	    			
	    			ps = res.indexOf("name=\"restcredit\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String restcredit = res.substring(ps,pe);	  
	    			
	    			ps = res.indexOf("name=\"pay_type\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String pay_type = res.substring(ps,pe);
	    			
	    			
	    			
	    			ps = res.indexOf("name=\"timestamp2\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			
	    			String timestamp2 = res.substring(ps,pe);
	    			
	    			
	    			
	    			ps = res.indexOf("name=\"wtype\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			
	    			String wtype = res.substring(ps,pe);
	    			
	    			
	    			
	    			
	    			String beturi = ADDRESS + "app/member/FT_order/FT_order_rou.php";
	    									   	
	    			
	    			
	    			

	    			
	    			
	    			
	    			
    		        List<NameValuePair> params = new ArrayList<NameValuePair>();		  
    		        params.add(new BasicNameValuePair("autoOdd", "Y"));
    		        params.add(new BasicNameValuePair("gold", Integer.toString(gold)));
    		        params.add(new BasicNameValuePair("uid", user_id));
    		        params.add(new BasicNameValuePair("langx", "zh-cn"));
    		        params.add(new BasicNameValuePair("active", "1"));

    		        params.add(new BasicNameValuePair("line_type", line_type));
    		        params.add(new BasicNameValuePair("gid", gid));
    		        params.add(new BasicNameValuePair("type", type));
    		        params.add(new BasicNameValuePair("gnum", gnum));
    		        params.add(new BasicNameValuePair("concede_h", concede_h));
    		        params.add(new BasicNameValuePair("radio_h", radio_h));
    		        params.add(new BasicNameValuePair("ioradio_r_h", ioradio_r_h));
    		        params.add(new BasicNameValuePair("gmax_single", gmax_single));
    		        params.add(new BasicNameValuePair("gmin_single", gmin_single));
    		        params.add(new BasicNameValuePair("singlecredit", singlecredit));
    		        params.add(new BasicNameValuePair("singleorder", singleorder));
    		        params.add(new BasicNameValuePair("restsinglecredit",restsinglecredit));
    		        params.add(new BasicNameValuePair("wagerstotal", wagerstotal));
    		        params.add(new BasicNameValuePair("restcredit", restcredit));
    		        params.add(new BasicNameValuePair("pay_type", pay_type));
    		        params.add(new BasicNameValuePair("odd_f_type", "M"));
    		        params.add(new BasicNameValuePair("timestamp2", timestamp2));
    		        params.add(new BasicNameValuePair("wtype", wtype));
    		        params.add(new BasicNameValuePair("timestamp",Long.toString(System.currentTimeMillis())));

	    			
    		        res = doPost(beturi, params, uri);
    		        
    		        
    		        if(res.contains("getElementById('newdomain')")){
		        		
		        		ps = res.indexOf("action");
		        		ps = res.indexOf("\'", ps) + 1;
		        		pe = res.indexOf("\'", ps);
		        		
		        		ADDRESS = res.substring(ps, pe) + "/";
		        		
		        		beturi = ADDRESS + "app/member/FT_order/FT_order_rou.php";
		        		
		        		res = doPost(beturi, params, uri);
		        	}
    		        
    		        
    		        lastBettime = System.currentTimeMillis();
    		        
    		        
    		        if(res.contains("è")){
                		res = new  String(res.getBytes("ISO-8859-1"), "utf-8");
                	}
    		        
    		        
    		        
    		        if(res.contains("成功提交注单")){
    		        	
    		        	ps = res.indexOf("model_ROU");
    		        	ps = res.indexOf("小", ps);
    		        	ps = res.indexOf("<em>", ps);
    		        	ps = ps + 4;
    		        	
    		        	pe = res.indexOf("<", ps);
    		        	
    		        	String pankoustr = res.substring(ps,pe).replace(" ", "");
    		        	
    		        	ps = res.indexOf("strong", pe);
    		        	ps = res.indexOf(">",ps) + 1;
    		        	pe = res.indexOf("<", ps);
    		        	
    		        	String ratiostr = res.substring(ps,pe);
    		        	
    		        	String[] rvalue = {"1", "小"+ pankoustr + "@"+ ratiostr};
    		        	
    		        	return rvalue;
    		        }else if(res.contains("提交注单待确认")){
    		        	ps = res.indexOf("model_ROU");
    		        	ps = res.indexOf("小", ps);
    		        	ps = res.indexOf("<em>", ps);
    		        	ps = ps + 4;
    		        	
    		        	pe = res.indexOf("<",ps);
    		        	
    		        	String pankoustr = res.substring(ps,pe).replace(" ", "");
    		        	
    		        	ps = res.indexOf("strong", pe);
    		        	ps = res.indexOf(">",ps) + 1;
    		        	pe = res.indexOf("<", ps);
    		        	
    		        	String ratiostr = res.substring(ps,pe);
    		        	
    		        	String[] rvalue = {"0","小"+ pankoustr + "@"+ ratiostr};
    		        	
    		        	return rvalue;
    		        }else if(res.contains("超过信用余额")){
    		        	String[] rvalue = {"-2",""};
    		        	return rvalue;
    		        }
    		        
    		        
    		        System.out.println(res);
	    			
	    			
		    		
		    	}else{
		    		System.out.println(res);
		    	}
	    		
	    		
	    	}catch(Exception e){
	    		e.printStackTrace();	    		
	    	}
	    	
	    	String[] rval = {"-1",""};
	    	
	    	return rval;
	    }
	    
	    
	    public String getShowTodayRecURL(){
	    	try{
	    		
	    		//http://66.133.86.54/app/member/history/history_data.php?uid=2kyn0n4xm17590281l2552691&langx=zh-cn
	    		
	    		return ADDRESS + "app/member/today/today_wagers.php?uid="+ user_id +"&langx=zh-cn";
	    		
	    		
//	    		String res = doGet(ADDRESS + "app/member/history/history_data.php?uid="+ user_id +"&langx=zh-cn", "", "");
//
//	    		StoneAgeClient.betlistWnd.updateBetlistVec(ADDRESS + "app/member/history/history_data.php?uid="+ user_id +"&langx=zh-cn");

	    		
	    	}catch(Exception e){
	    		e.printStackTrace();
	    		
	    		
	    	}
	    	
	    	return "";
	    }
	    
	    
	    public String getHistoryRecURL(){
	    	try{
	    		
	    		//http://66.133.86.54/app/member/history/history_data.php?uid=2kyn0n4xm17590281l2552691&langx=zh-cn
	    		
	    		return ADDRESS + "app/member/history/history_data.php?uid="+ user_id +"&langx=zh-cn";
	    		
	    		
//	    		String res = doGet(ADDRESS + "app/member/history/history_data.php?uid="+ user_id +"&langx=zh-cn", "", "");
//
//	    		StoneAgeClient.betlistWnd.updateBetlistVec(ADDRESS + "app/member/history/history_data.php?uid="+ user_id +"&langx=zh-cn");

	    		
	    	}catch(Exception e){
	    		e.printStackTrace();
	    		
	    		
	    	}
	    	
	    	return "";
	    }
	    
	    
	    //0未知， 1成功 -1失败
	    public  int notconfirmGame(String team){
	    	
	    	
	    	try{
	    		
	    		if(System.currentTimeMillis() - lastConfirmtime < 5*1000){
	    			return 0;
	    		}
	    		

	    		
	    		
	    		
	    		String res = doGet(ADDRESS + "app/member/today/show10rec.php?uid="+ user_id +"&langx=zh-cn", "", "");
		    	
		    	if(res == null){
		    		Thread.sleep(2000);
		    		res = doGet(ADDRESS + "app/member/today/show10rec.php?uid="+ user_id +"&langx=zh-cn", "", "");
		    	}
		    	
		    	
		    	
		    	
		    	if(res!= null){
		    		
		    		if(res.contains("logout_warn")){
		    			Thread.sleep(2000);
		    			int loginres = login();
		    			if(loginres == 1){
		    				
		    				Thread.sleep(2000);
		    				
		    				res = doGet(ADDRESS + "app/member/today/show10rec.php?uid="+ user_id +"&langx=zh-cn", "", "");
		    			}else{
		    				return 0;
		    			}
		    		}
		    		
		    		
		    		
		    		
		    		
		        	if(res.contains("è")){
	            		res = new  String(res.getBytes("ISO-8859-1"), "utf-8");
	            	}
		    		
		        	
		        	
		        	
		        	System.out.println("确认结果:" + res);
		    		
		    		int ps = res.indexOf("最新十笔交易");
		    		
		    		//System.out.println(res);
		    		
		    		
		    		lastConfirmtime = System.currentTimeMillis();
		    		
		    		if(ps != -1){
		    			
		    			

		    			
		    			
		    			
		    			ps = res.indexOf(team, ps);
		    			
		    			//System.out.println(res);
		    			
		    			if(ps != -1){
		    				ps = res.indexOf("<div", ps);
		    				int pe = res.indexOf("div>", ps);
		    				
		    				String betres = res.substring(ps,pe);
		    				
		    				if(res.contains("投注失败")){
		    					
		    					System.out.println("确认投注失败：" + res);
		    					
		    					return 0;// never bet twice
		    				}else if(res.contains("待确认")){
		    					return 0;
		    				}else if(res.contains("确认")){
		    					return 1;
		    				}
		    				
		    			}
		    		}
		    		
		    	}
		    	
		    	
		    	
		    	return 0;
	    		
	    		
	    	}catch(Exception e){
	    		
	    		
	    		System.out.println("in catch: 投注失败");
	    		
	    		e.printStackTrace();
		    	
		    	return 0;
	    		
	    	}
	    	
	    	
	    	
	    	
	    }
	    
	    
	    
	    public  Map<String, String> getBetDXQdetails(String gid, String gnum, String type){
	    	
	    	String uri = ADDRESS + "app/member/FT_order/FT_order_rou.php?gid=" + gid + "&uid=" + user_id + "&odd_f_type=M&type=" + type + 
    				"&gnum=" + gnum +  "&langx=zh-cn";
	    	
	    	String res = doGet(uri, "", "");
	    	
	    	Map<String, String> map=new HashMap<String, String>();
	    	
	    	if(res == null){
	    		res = doGet(uri, "", "");
	    	}
	    	
	    	if(res.contains("确定交易")){
	    		
    			int ps = res.indexOf("name=\"active\"");
    			ps = res.indexOf("value=", ps);
    			ps = res.indexOf("\"", ps) + 1;
    			int pe = res.indexOf("\"", ps);
    			
    			String active = res.substring(ps,pe);
    			
    			ps = res.indexOf("name=\"line_type\"");
    			ps = res.indexOf("value=", ps);
    			ps = res.indexOf("\"", ps) + 1;
    			pe = res.indexOf("\"", ps);
    			
    			String line_type = res.substring(ps,pe);
    			
    			ps = res.indexOf("name=\"concede_h\"");
    			ps = res.indexOf("value=", ps);
    			ps = res.indexOf("\"", ps) + 1;
    			pe = res.indexOf("\"", ps);
    			
    			String concede_h = res.substring(ps,pe);
    			
    			
    			
    			ps = res.indexOf("name=\"radio_h\"");
    			ps = res.indexOf("value=", ps);
    			ps = res.indexOf("\"", ps) + 1;
    			pe = res.indexOf("\"", ps);
    			
    			String radio_h = res.substring(ps,pe);
    			
    			
    			ps = res.indexOf("name=\"ioradio_r_h\"");
    			ps = res.indexOf("value=", ps);
    			ps = res.indexOf("\"", ps) + 1;
    			pe = res.indexOf("\"", ps);
    			
    			String ioradio_r_h = res.substring(ps,pe);
    			
    			
    			ps = res.indexOf("name=\"gmax_single\"");
    			ps = res.indexOf("value=", ps);
    			ps = res.indexOf("\"", ps) + 1;
    			pe = res.indexOf("\"", ps);
    			
    			String gmax_single = res.substring(ps,pe);	   
    			
    			
    			ps = res.indexOf("name=\"gmin_single\"");
    			ps = res.indexOf("value=", ps);
    			ps = res.indexOf("\"", ps) + 1;
    			pe = res.indexOf("\"", ps);
    			
    			String gmin_single = res.substring(ps,pe);	  
    			
    			
    			ps = res.indexOf("name=\"singlecredit\"");
    			ps = res.indexOf("value=", ps);
    			ps = res.indexOf("\"", ps) + 1;
    			pe = res.indexOf("\"", ps);
    			
    			String singlecredit = res.substring(ps,pe);	  
    			
    			
    			
    			ps = res.indexOf("name=\"singleorder\"");
    			ps = res.indexOf("value=", ps);
    			ps = res.indexOf("\"", ps) + 1;
    			pe = res.indexOf("\"", ps);
    			
    			String singleorder = res.substring(ps,pe);	  
    			
    			
    			
    			ps = res.indexOf("name=\"restsinglecredit\"");
    			ps = res.indexOf("value=", ps);
    			ps = res.indexOf("\"", ps) + 1;
    			pe = res.indexOf("\"", ps);
    			
    			String restsinglecredit = res.substring(ps,pe);	  
    			
    			ps = res.indexOf("name=\"wagerstotal\"");
    			ps = res.indexOf("value=", ps);
    			ps = res.indexOf("\"", ps) + 1;
    			pe = res.indexOf("\"", ps);
    			
    			String wagerstotal = res.substring(ps,pe);	  
    			
    			
    			ps = res.indexOf("name=\"restcredit\"");
    			ps = res.indexOf("value=", ps);
    			ps = res.indexOf("\"", ps) + 1;
    			pe = res.indexOf("\"", ps);
    			
    			String restcredit = res.substring(ps,pe);	  
    			
    			ps = res.indexOf("name=\"pay_type\"");
    			ps = res.indexOf("value=", ps);
    			ps = res.indexOf("\"", ps) + 1;
    			pe = res.indexOf("\"", ps);
    			
    			String pay_type = res.substring(ps,pe);
    			
    			
    			map.put("ratio", ioradio_r_h);
    			map.put("minbet", gmin_single);
    			map.put("maxbet", gmax_single);
    			
    			
	    		
	    	}
	    	
	    	return map;
	    }
	    
	    
	    
		
	    
	    
	    public  boolean betPankou(String gid, String gnum, String strong, String type, int gold){
	    	
	    	//http://66.133.87.54/app/member/FT_order/FT_order_r.php?gid=2988462&uid=oa3bzktjvdm17462566l1796082&odd_f_type=H&type=H&gnum=10518&strong=C&langx=zh-cn
	    	try{
	    		String uri = ADDRESS + "app/member/FT_order/FT_order_r.php?gid=" + gid + "&uid=" + user_id + "&odd_f_type=M&type=" + type + 
	    				"&gnum=" + gnum + "&strong=" + strong + "&langx=zh-cn";
	    		
	    		String res = doGet(uri, "", "");
	    		
	    		if(res.contains("确定交易")){
	    			//uri = 
	    			int ps = res.indexOf("name=\"active\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			int pe = res.indexOf("\"", ps);
	    			
	    			String active = res.substring(ps,pe);
	    			
	    			ps = res.indexOf("name=\"line_type\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String line_type = res.substring(ps,pe);
	    			
	    			ps = res.indexOf("name=\"concede_r\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String concede_r = res.substring(ps,pe);
	    			
	    			
	    			
	    			ps = res.indexOf("name=\"radio_r\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String radio_r = res.substring(ps,pe);
	    			
	    			
	    			ps = res.indexOf("name=\"ioradio_r_h\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String ioradio_r_h = res.substring(ps,pe);
	    			
	    			
	    			ps = res.indexOf("name=\"gmax_single\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String gmax_single = res.substring(ps,pe);	   
	    			
	    			
	    			ps = res.indexOf("name=\"gmin_single\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String gmin_single = res.substring(ps,pe);	  
	    			
	    			
	    			ps = res.indexOf("name=\"singlecredit\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String singlecredit = res.substring(ps,pe);	  
	    			
	    			
	    			
	    			ps = res.indexOf("name=\"singleorder\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String singleorder = res.substring(ps,pe);	  
	    			
	    			
	    			
	    			ps = res.indexOf("name=\"restsinglecredit\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String restsinglecredit = res.substring(ps,pe);	  
	    			
	    			ps = res.indexOf("name=\"wagerstotal\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String wagerstotal = res.substring(ps,pe);	  
	    			
	    			
	    			ps = res.indexOf("name=\"restcredit\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String restcredit = res.substring(ps,pe);	  
	    			
	    			ps = res.indexOf("name=\"pay_type\"");
	    			ps = res.indexOf("value=", ps);
	    			ps = res.indexOf("\"", ps) + 1;
	    			pe = res.indexOf("\"", ps);
	    			
	    			String pay_type = res.substring(ps,pe);	  
	    			
	    			
	    			
	    			String beturi = ADDRESS + "app/member/FT_order/FT_order_r.php";
	    			
	    			
    		        List<NameValuePair> params = new ArrayList<NameValuePair>();		  
    		        params.add(new BasicNameValuePair("autoOdd", "Y"));
    		        params.add(new BasicNameValuePair("gold", Integer.toString(gold)));
    		        params.add(new BasicNameValuePair("uid", user_id));
    		        params.add(new BasicNameValuePair("langx", "zh-cn"));
    		        params.add(new BasicNameValuePair("active", "1"));
    		        params.add(new BasicNameValuePair("strong", strong));
    		        params.add(new BasicNameValuePair("line_type", line_type));
    		        params.add(new BasicNameValuePair("gid", gid));
    		        params.add(new BasicNameValuePair("type", type));
    		        params.add(new BasicNameValuePair("gnum", gnum));
    		        params.add(new BasicNameValuePair("concede_r", concede_r));
    		        params.add(new BasicNameValuePair("radio_r", radio_r));
    		        params.add(new BasicNameValuePair("ioradio_r_h", ioradio_r_h));
    		        params.add(new BasicNameValuePair("gmax_single", gmax_single));
    		        params.add(new BasicNameValuePair("gmin_single", gmin_single));
    		        params.add(new BasicNameValuePair("singlecredit", singlecredit));
    		        params.add(new BasicNameValuePair("singleorder", singleorder));
    		        params.add(new BasicNameValuePair("restsinglecredit",restsinglecredit));
    		        params.add(new BasicNameValuePair("wagerstotal", wagerstotal));
    		        params.add(new BasicNameValuePair("restcredit", restcredit));
    		        params.add(new BasicNameValuePair("pay_type", pay_type));
    		        params.add(new BasicNameValuePair("odd_f_type", "M"));
    		        params.add(new BasicNameValuePair("timestamp",Long.toString(System.currentTimeMillis())));

	    			
    		        res = doPost(beturi, params, uri);
    		        
    		        
    		        if(res.contains("成功提交注单")){
    		        	return true;
    		        }
    		        
    		        
    		        
	    			
	    		}
	    		
	    	}catch(Exception e){
	    		e.printStackTrace();
	    	}
	    	
	    	
	    	return false;
	    }
	    
	    
	    
	    
	    
	    
	    
	    public static   CloseableHttpResponse  execute(HttpUriRequest request) throws IOException, ClientProtocolException{
	    	
	    	long time1 = System.currentTimeMillis();
	    	long time2 = System.currentTimeMillis();
	    	
	    	/*SimpleDateFormat dfSec = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			String currenttimestr = dfSec.format(System.currentTimeMillis());*/
			
		//	System.out.println("execute time:" + currenttimestr);
	    	
	    	CloseableHttpResponse response;
	    	try{
	    		Thread.sleep(300);
	    	}catch(Exception e){
	    		e.printStackTrace();
	    	}
	    	
	    	
	    	try{
	    		response = httpclient.execute(request);    		
	    		time2 = System.currentTimeMillis();    		
	    		calcRequestAveTime(time2 - time1);
	    		
	    	}catch(Exception e){
	    		
	    		time2 = System.currentTimeMillis();
	    		calcRequestAveTime(time2 - time1);
	    		
	    		throw e;
	    	}
	    	

	    	
	    	return response;
	    	
	    }
	    
	    
	    public static  String doGet(String url, String cookies, String referUrl) {
	    	
	        try {  
	            // 创建httpget.    
	            HttpGet httpget = new HttpGet(url);
	            
	            if(cookies != "") {
	            	httpget.addHeader("Cookie",cookies);
	            }
	            httpget.addHeader("Accept-Encoding","Accept-Encoding: gzip, deflate, sdch");
	            httpget.addHeader("Accept-Language","Accept-Language: zh-CN,zh;q=0.8");
	            httpget.addHeader("Connection","keep-alive");
	            httpget.addHeader("Upgrade-Insecure-Requests","1");
	            httpget.addHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
	            //
	            
	            if(referUrl != "")
	            {
	            	httpget.addHeader("Referer",referUrl);
	            	
	            }
	            
	            httpget.addHeader("User-Agent","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36");           
	           // System.out.println("executing request " + httpget.getURI()); 
	           
	            //设置超时
	            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(defaultTimeout).setConnectTimeout(defaultTimeout).build();
	            httpget.setConfig(requestConfig);
	            
	            // 执行get请求.    
	            CloseableHttpResponse response = execute(httpget); 
	            
	            String statusLine = response.getStatusLine().toString();   
	            if(statusLine.indexOf("200 OK") == -1) {
	         	  // System.out.println(statusLine); 
	            }
	            
	            try{
	            	setCookie(response);  	
	            	//System.out.println("设置cookie:" + strCookies);
	            	
	            	if(response.getStatusLine().toString().indexOf("302 Found") > 0) {
	             	   return response.getFirstHeader("Location").getValue();
	                }
	                HttpEntity entity = response.getEntity(); 
	                
	                String res = EntityUtils.toString(entity);
	                
	                if(res != null && res.length() > 0 ){     
	                	//System.out.println(res);
	                    return res;
	                }
	            }finally{
	                httpget.releaseConnection();
	                response.close();
	            }
	            

	            

	        } catch (ClientProtocolException e) {  
	            e.printStackTrace(); 
	        } catch (ParseException e) {  
	            e.printStackTrace(); 
	        } catch (IOException e) {  
	            e.printStackTrace(); 
	        } catch (Exception e){
	        	e.printStackTrace();
	        }
	        
	        return null;
	    }
	    
	    
	    
	    /**以utf-8形式读取*/
	    public static  String doPost(String url,List<NameValuePair> formparams, String cookies) {
	        return doPost(url, formparams,"UTF-8", cookies);
	    }

	    public static  String doPost(String url,List<NameValuePair> formparams,String charset, String cookies) {


	     // 创建httppost   
	    	
	    	try {
	    	
	        HttpPost httppost = new HttpPost(url); 
	        
	/*        if(url.contains("get_today_ft_league_wager.php")){
	        	httppost.addHeader("Cookie", strCookies);
	        }*/
	        
	        //httppost.addHeader("Cookie", cookies);
	        //httppost.addHeader("Accept-Encoding","Accept-Encoding: gzip, deflate, sdch");
	        //httppost.addHeader("x-requested-with","XMLHttpRequest");
	        httppost.addHeader("Accept-Language","Accept-Language: zh-CN");
	        httppost.addHeader("Accept","application/json, text/javascript, */*; q=0.01");
	        httppost.addHeader("Accept-Encoding","gzip, deflate");
	        httppost.addHeader("Connection","keep-alive");
	        httppost.addHeader("Cache-Control","max-age=0");
	        httppost.addHeader("User-Agent","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36");    


	        UrlEncodedFormEntity uefEntity;
	        
	            uefEntity = new UrlEncodedFormEntity(formparams, charset);
	            httppost.setEntity(uefEntity);
	            
	            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(defaultTimeout).setConnectTimeout(defaultTimeout).build();
	            httppost.setConfig(requestConfig);
	            
	            CloseableHttpResponse response = execute(httppost);
	            try {
	                // 打印响应状态    
	            	setCookie(response);
	            	//System.out.println("设置cookie:" + strCookies);
	            	if(response.getStatusLine().toString().indexOf("302 Found") > 0) {
	            		String location = response.getFirstHeader("Location").getValue();
	            		//System.out.println(response.getStatusLine());
	            		
	            		
	            		
	            		if(location != null) {
	            			return location;
	            		}
	            	}
	            	
	            	
	            	
	            	//Header headers[] = response.getHeaders("Content-Type");
	            	
	            	
	                HttpEntity entity = response.getEntity(); 
	                
	                String res = "";
	                
	                if(url.contains("get_today_ft_league_wager.php") || url.contains("app/ft/get_today_ft_allbets_wager.php")){            		
	                	res = new  String(EntityUtils.toString(entity).getBytes("ISO-8859-1"), "UTF-8");
	                }else{
	                	res = EntityUtils.toString(entity);
	                }
	                
	                
	                if(res != null && res.length() > 0 ){     
	                	//System.out.println(res);
	                    return res;
	                }
	            	
	            	

	            } finally {  
	            	httppost.releaseConnection();
	                response.close(); 
	            }  
	        } catch (ClientProtocolException e) {  
	            e.printStackTrace(); 
	        } catch (UnsupportedEncodingException e1) {  
	            e1.printStackTrace(); 
	        } catch (IOException e) {  
	            e.printStackTrace(); 
	     
	        } catch(Exception e){
	     	   e.printStackTrace();
	        } 
	        return null;
	    }
	    
	    
	    
		public static  String setCookie(CloseableHttpResponse httpResponse)
		{
			//strCookies = "";
			//System.out.println("----setCookieStore");
			Header headers[] = httpResponse.getHeaders("Set-Cookie");
			if (headers == null || headers.length==0)
			{
				//System.out.println("----there are no cookies");
				return null;
			}

			String cookie = "";
			for (int i = 0; i < headers.length; i++) {
				cookie += headers[i].getValue();
				if(i != headers.length-1)
				{
					cookie += ";";
				}
			}
			String cookies[] = cookie.split(";");
			
			for (String c : cookies)
			{
				if(c.indexOf("path=") != -1 || c.indexOf("expires=") != -1 || c.indexOf("domain=") != -1 || c.indexOf("HttpOnly") != -1)
					continue;
				strCookies += c;
				strCookies += ";";
			}
			//System.out.println("----setCookieStore success");

			return strCookies;
		}
	    
	    
	    public synchronized static  void calcRequestAveTime(long requestTime){
	        
	    	if(bcalcRequestTime == true){
	    		
	        	//requestCount++;
	        	
	    		long totalReqeustTime = 0;
	    		
	        	lastTenRequestTime.add(requestTime);
	        	
	        	while(lastTenRequestTime.size() >10){
	        		lastTenRequestTime.remove(0);
	        	}
	        	
	        	
	        	if(lastTenRequestTime.size() == 10){
	            	for(int i = 0; i < lastTenRequestTime.size(); i++){
	            		totalReqeustTime += lastTenRequestTime.elementAt(i);
	            	}
	            	avgRequestTime = totalReqeustTime/lastTenRequestTime.size();
	            	
	            	
	            	//System.out.printf("[迪斯尼会员]平均请求时间:%d\n", avgRequestTime);
	            	
	            	
	            	long currentTime = System.currentTimeMillis();
	            	
	            	long passTime = currentTime - lastChangeLineTime;
	            	
	            	if(avgRequestTime >= 500 && passTime >= 90*1000){
	            		//setisNeedChangeLine(true);
	            		lastChangeLineTime = currentTime;
	            	}

	        	}

	    	}

	    		
	    	
	    }
	    
	    
	    
	    
	    
	    
}
